//
//  PrintDataAppendTool.m
//  BluetoothPrint
//
//  Created by wang on 2017/11/3.
//  Copyright © 2017年 wang. All rights reserved.
//

#import "PrintDataAppendTool.h"
#import "WYHPrintForm.h"
@implementation PrintDataAppendTool

//拼接打印数据
- (void)printAppendData
{
    
//    for (int i = 0; i<100; i++) {
//        [self printText:[NSString stringWithFormat:@"第%@行",@(i)]];
//        [self printEnter];
//    }
//    [self aaa:1];
//    [self bbb:2];
    
    NSArray *jsonArr = [self.printDic objectForKey:@"json"];
    if (jsonArr) {
//        [self someStrPrintAppend:jsonArr textAlignment:NSTextAlignmentLeft symbol:@""];
    }

//    [self someStrPrintAppend:@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10"] leftMarginArr:@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10"] textAlignment:NSTextAlignmentLeft];
    [self printText:@"打印表格"];
    [self printEnter];
    [self printText:@"打印表格"];
    [self printEnter];
//    [self aaa:1];
    
    //行间距设置为0
//    [self printRowHeightSpaceZero];
//    [self printRowWidthSpaceZero];
    WYHPrintForm *form = [[WYHPrintForm alloc] initFormWithchangeColsWidthArr:@[@12,@13,@25]];
    form.lineFeed = YES;
    //得实打印机出现弯的竖线是因为 打印机没有设置为单向打印   或者把一行打满，就是打印的宽一点
    [form formStart];
    [form addRow:@[@"网123456789abcdefghijklmnopqrstuvwxyz易",@"天123456789abcdefghijklmnopqrstuvwxyz天",@"哈123456789abcdefghijklmnopqrstuvwxyz哈哈"]];
    [form changeColsWidthArr:@[@23,@12,@15]];
    [form addRow:@[@"哈123456789abcdefghijklmnopqrstuvwxyz哈哈",@"哈123456789abcdefghijklmnopqrstuvwxyz哈哈",@"哈123456789abcdefghijklmnopqrstuvwxyz哈哈"]];
    [form changeColsWidthArr:@[@25,@26]];
    [form addRow:@[@"11123456789abcdefghijklmnopqrstuvwxyz",@"22"]];
    [form changeColsWidthArr:@[@24,@22,@4]];
    [form addRow:@[@"哈哈哈",@"哈123456789abcdefghijklmnopqrstuvwxyz哈哈",@"哈哈哈"]];
    [form changeColsWidthArr:@[@23,@5,@22]];
    [form addRow:@[@"恩恩哈哈哈哈哈哈",@"哈12345哈哈",@"哈哈哈"]];
    [form changeColsWidthArr:@[@52]];
    [form addRow:@[@"哈哈123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz哈123456789abcdefghijklmnopqrstuvwxyz"]];
    [form changeColsWidthArr:@[@52]];
    [form addRow:@[@"哈哈哈问问123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz哈哈哈"]];
    [form formEnd];
    NSString *printStr = [form getFormContent];
    [self printText:printStr];
    //恢复行间距
//    [self printRowHeightSpaceNormal];
//    [self printRowWidthSpaceNormal];
    [self printText:@"打印表格"];
    [self printEnter];
    [self printText:@"打印表格"];
    [self printEnter];
    [self printText:@"打印表格"];
    [self printEnter];
    [self printEnd];
}

@end
